#计算元素的主对角线之和
'''
lst = [[3,5,6],[9,10,21],[4,22,18]]
sum = lst[0][0]+lst[1][1]+lst[2][2]
print(sum)
# sum = 31
'''

'''
lst = [[3,5,6],[9,10,21],[4,22,18]]
sum = lst[1][1]+lst[2][2]+lst[3][3]
print(sum)
# error
'''

'''
lst = [[3,5,6],[9,10,21],[4,22,18]]
sum = 0
for i in range(3):
    sum+=lst[i][i]
print(sum)
# sum = 31
'''

'''
lst = [[3,5,6],[9,10,21],[4,22,18]]
sum = 0
for i in lst:
    sum+=i[lst.index(i)]
print(sum)
# sum = 31
'''